using System;
using UnityEngine;
using Voodoo.Pattern;

public class RenewableRVButton : MonoBehaviour
{
	public GameObject _Button;

	private void Start()
	{
		GameManager instance = SingletonMB<GameManager>.Instance;
		instance.OnGameEnd = (Action)Delegate.Combine(instance.OnGameEnd, new Action(OnGameEnd));
		_Button.SetActive(SingletonMB<GameManager>.Instance.ReturnCount > 3 && Preloader.RenewableEnergyBooster.IsEnabled);
	}

	private void OnGameEnd()
	{
		_Button.SetActive(SingletonMB<GameManager>.Instance.ReturnCount > 3 && Preloader.RenewableEnergyBooster.IsEnabled);
	}

	public void OnRVClick()
	{
		if (SingletonMB<GameManager>.Instance.BetterNoAds)
		{
			SingletonMB<GameManager>.Instance.ActivateRenewable();
		}
		else
		{
			SingletonMB<GameManager>.Instance.ActivateRenewable();
		}
	}
}
